package hmi;

import javax.swing.JComponent;

public abstract class View<Model> implements IView<Model> {
//
// Represents the view in the MFW Hmi orgaization
//
	private	Model				model = null;
	private	IController<Model>	controller = null;
	private JComponent			component = null;
	
	//
	// Getters
	//
	@Override
	public Model getModel() {
		return this.model;
	}
	@Override
	public IController<Model> getController() {
		return this.controller;
	}
	@Override
	public JComponent getComponent() {
		return this.component;
	}

	//
	// Setters
	//
	@Override
	public void setModel(Model model) {
		this.model = model;
	}
	@Override
	public void setController(IController<Model> controller) {
		this.controller = controller;
	}
	@Override
	public void setComponent(JComponent component) {
		if (this.component!=null)	{	removeListeners(this.component);	}
		this.component = component;
		if (this.component!=null)	{	addListeners(this.component);		}
	}
	
	//
	// Listeners for events on a component
	//
	@Override
	public abstract void addListeners(JComponent component);
	@Override
	public abstract void removeListeners(JComponent component);

}
